<?php

namespace App\Http\Controllers\Mobile;


use App\Logics\EventLogic;
use App\Logics\NewsLogic;


class PublishController extends BaseController
{
    // 个人资料（必须登录）
    public function initialize()
    {
        parent::initialize();
    }

    // 发布文章
    public function news()
    {
        $logic  = new NewsLogic();
        $result = $logic->onAdd($this->myUid);
        if($result === false){
            return $this->error($logic->getError());
        }

        return $this->success($result);
    }

    // 发布活动：赛事+研学
    public function event()
    {
        $user = $this->myUser;
        if(empty($user['is_auth'])){
            return $this->error('你不是认证用户！');
        }
        if($user['verify'] != 1){
            return $this->error('你选择的用户认证未通过！');
        }

        // 查询
        $logic  = new EventLogic();
        $result = $logic->onAdd($this->myUid);
        if($result === false){
            return $this->error($logic->getError());
        }

        return $this->success($result);
    }


}


